#
# OS dependent macros
#

CC = arm-elf-gcc
AS = arm-elf-as
AFLAGS = --gdwarf2 -I../inc

LD = arm-elf-ld -T def.ld -Map netload.map

CFLAGS = -fsigned-char -gdwarf-2 -c -I../inc
AR = arm-elf-ar
RM      = rm -f
MAKE    = make

CP      = cp


#
# Target dependent macros
#

OBJFILES =  LH7A400_evbstart.o \
#            LH7A400_ssp_driver.o \
            LH7A400_lcd_driver.o \
			LH7A400_evbmeminit.o \
			LH7A400_defclk.o \
			LH7A400_exception_driver.o \
			LH7A400_evbmmuinit.o \
			LH7A400_evbmmuinit_data.o \
			LH7A400_gpio_driver.o \
			LH7A400_CSC_driver.o \
			LH7A400_uart_driver.o \
			LH7A400_timer_driver.o \
#			watertek_main.o \
			watertek_cpld_driver.o \
			watertek_dm9000_driver.o \
#			watertek_tp_driver.o \
			net_arp.o \
			net_cksum.o \
			net_icmp.o \
			net_ip.o \
			net_main.o \
#			watertek_ascii.o \
#			watertek_icon.o \
			NET_Udp.o \
			loader.o \
			loadmisc.o \

netload.bin : netload.elf
	arm-elf-objcopy -O binary netload.elf netload.bin
netload.elf: $(OBJFILES)
	$(LD) -o netload.elf $(OBJFILES) --start-group ../lib/*.a -lc -lgcc -lm --end-group

.c.o:
	$(CC) $(CFLAGS) -o $*.o $*.c

.cpp.o:
	$(CC) $(CFLAGS) -o $*.o $*.cpp

LH7A400_evbstart.o: LH7A400_evbstart.s
	$(AS) $(AFLAGS) -o $*.o $*.s

clean:
	del *.o
	del *.elf
	del *.map
	del *.bin